<?php

namespace app\index\validate;

use think\Validate;

class UserValidator extends Validate
{
    protected $rule = [ 'username' => "require|max:15|different:dbname",//name要求1.必须有值 2.长度不能超过10
        'password'=>'require|confirm',

    ];


    // 验证提示信息
    protected $message = ['username.require' => '必须输入用户名',
        "name.max" =>"用户名不得超过十五个字符",
        "password.require"=>"密码不能为空",
        "password.confirm"=>"两次密码不相同",
        'username.different'=>'用户名已存在'
    ];

    // 验证场景 scene = ['edit'=>'name1,name2,...']
    protected $scene = ['edit'=>'username,password','apple'=>'password'];




}